#include <stdio.h>
#include "MPX_SUPT.H"
#include "COMMANDH.H"
#include "R3.h"

#define CURRENT_MODULE MODULE_R3

FILE *title_file;

int main()
{
	int sys_init_error; //used to grab error from sys_init
	int sys_set_vec_error;
	
	sys_set_vec_error = sys_set_vec(sys_call);
	if (sys_set_vec_error) //if error exists, print message, otherwise, continue
		printf("There was a problem with sys_set_vec, error #%d\0", sys_set_vec_error);
	
	sys_init_error = sys_init(CURRENT_MODULE);
	if (sys_init_error) //if error exists, print message, otherwise, continue
		printf("There was a problem with sys_init, error #%d\0", sys_init_error);
	
	
		//print title
		if ((title_file = fopen("title.txt", "r")) == NULL){
		printf("There was an error opening the title file\n");
		}	
		//print title file one character at a time
		else{
			int c;
			while((c = fgetc(title_file)) != EOF){
				printf("%c", c);
			}
			printf("\n");
			//close help file
			fclose(title_file);
		}
		printf("Featuring...\n");
		printf("Jeffrey Brenwald\n");
		printf("Amber Cline\n");
		printf("Jordan Hitrik\n");
		printf("and Jim Stevens\n");
	
	
	command_handler();
	
	printf("\nThank you for using Team Adventure Time MPX\nPlease come again\0");
	sys_exit();
	return 0;
}